package com.wonders.frame.common.util;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;

/**
 * @author 顾乘瑞
 */
public class FileUtil {

    public static void createFile(String content, String filePath){
        File writeFile = new File(filePath);
        PrintWriter pw = null;
        try {
            pw = new PrintWriter(new FileWriter(filePath));
            pw.write(content);
        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            pw.flush();
            pw.close();
        }
        if (!writeFile.exists()) {
            try {
                writeFile.createNewFile();
            } catch (IOException ex) {
                ex.printStackTrace();
            }
        }
    }
}
